package com.fancy.net.stream.login
{
	import com.fancy.net.sock.SockUtil;
	import com.fancy.net.stream.DecodeBase;
	import com.fancy.net.stream.StreamDefine;
	
	import flash.utils.ByteArray;
	
	public class LoginBack extends DecodeBase
	{
		public static const MSG_ID:String = "0104";
		
		public function LoginBack()
		{
			super();
		}
		
		override protected function getMsgId():String { return MSG_ID; }
		
		override protected function makeVO(bytes:ByteArray):Object
		{
			var vo:Object = new Object();
			var roleCount:int = bytes.readUnsignedByte();
			vo["roleCount"] = roleCount;
			var roleArr:Array = [];
			for(var i:int = 0; i < roleCount; i++)
			{
				var roleInfo:Object = new Object();
				roleInfo["i64Id"] = SockUtil.readInt64ToStr(bytes);
				roleInfo["name"] = bytes.readMultiByte(StreamDefine.MAX_NAME_LEN, "gb2312");
				roleInfo["sex"] = bytes.readByte();
				roleArr.push(roleInfo);
			}
			vo["roleArr"] = roleArr;
			return vo;
		}
		
	}
}